package com.fs.alert.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fs.alert.domain.po.Detection;
import com.fs.alert.service.IDetectionService;
import com.fs.common.domain.Result;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@Api(tags = "检测结果相关接口")
@RestController
@RequestMapping("/detections")
@RequiredArgsConstructor
@Slf4j
public class DetectionController {
    private final IDetectionService detectionService;

    @GetMapping("/detection/{alertId}")
    public Result getDetectionsByAlertId(
            @PathVariable Long alertId,
            @RequestParam(defaultValue = "1") int pageNum,
            @RequestParam(defaultValue = "10") int pageSize) {
        return Result.ok(detectionService.getDetectionsByAlertId(alertId, pageNum, pageSize));
    }
}
